package com.school.controller;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.school.entity.HljtSubject;
import com.school.service.impl.HljtSubjectManagerServiceImpl;
import com.school.util.RepUtil;

@Controller
@RequestMapping(value="HljtSubjectManagerController")
public class HljtSubjectManagerController {

	@Autowired
	HljtSubjectManagerServiceImpl oHljtSubjectManagerServiceImpl;
	
	/**
	 * 查询所有科目
	 * @param SubjectName
	 * @param rep
	 * @return
	 */
	@RequestMapping(value="/findAllSubjectByName")
	@ResponseBody
	public String findAllSubjectByName(String SubjectName,HttpServletResponse rep){
		RepUtil.repPake(rep);
		return oHljtSubjectManagerServiceImpl.findAllSubjectByName(SubjectName);
		
	}
	
	/**
	 * 添加科目
	 * @param oHljtSubject
	 * @param rep
	 * @return
	 */
	@RequestMapping(value="/insertSubject")
	@ResponseBody
	public String insertSubject(HljtSubject oHljtSubject,HttpServletResponse rep){
		RepUtil.repPake(rep);
		return oHljtSubjectManagerServiceImpl.insertSubject(oHljtSubject);
	}
	/**
	 * 删除科目
	 * @param id
	 * @param rep
	 * @return
	 */
	@RequestMapping(value="/deleteSubject")
	@ResponseBody
	public int deleteSubject(int id,HttpServletResponse rep){
		RepUtil.repPake(rep);
		return oHljtSubjectManagerServiceImpl.deleteSubject(id);
	}
	
	/**
	 * 修改科目
	 * @param oHljtSubject
	 * @param rep
	 * @return
	 */
	@RequestMapping(value="/updateSubject")
	@ResponseBody
	public String updateSubject(HljtSubject oHljtSubject,HttpServletResponse rep){
		RepUtil.repPake(rep);
		return oHljtSubjectManagerServiceImpl.updateSubject(oHljtSubject);
	}
}
